Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

storyblok-js-client

Package Overview
Dependencies
Maintainers
7
Versions
200
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storyblok-js-client

Universal JavaScript SDK for Storyblok's API

  • 5.14.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
91K
decreased by-40.08%
Maintainers
7
Weekly downloads
 
Created

What is storyblok-js-client?

The storyblok-js-client is a JavaScript client for interacting with the Storyblok API. It allows developers to easily manage content, perform CRUD operations, and interact with the Storyblok content delivery and management APIs.

What are storyblok-js-client's main functionalities?

Initialize the Client

This feature allows you to initialize the Storyblok client with your access token, which is required to authenticate and interact with the Storyblok API.

const StoryblokClient = require('storyblok-js-client');
const client = new StoryblokClient({
  accessToken: 'your-access-token'
});

Get a Story

This feature allows you to fetch a specific story from the Storyblok API. In this example, it fetches the 'home' story.

client.get('cdn/stories/home', {}).then(response => {
  console.log(response.data.story);
}).catch(error => {
  console.error(error);
});

Create a Story

This feature allows you to create a new story in your Storyblok space. The example demonstrates creating a story with a name, slug, and content.

client.post('spaces/your-space-id/stories', {
  story: {
    name: 'New Story',
    slug: 'new-story',
    content: {
      component: 'page',
      body: []
    }
  }
}).then(response => {
  console.log(response.data.story);
}).catch(error => {
  console.error(error);
});

Update a Story

This feature allows you to update an existing story in your Storyblok space. The example shows how to update the name, slug, and content of a story.

client.put('spaces/your-space-id/stories/your-story-id', {
  story: {
    name: 'Updated Story',
    slug: 'updated-story',
    content: {
      component: 'page',
      body: []
    }
  }
}).then(response => {
  console.log(response.data.story);
}).catch(error => {
  console.error(error);
});

Delete a Story

This feature allows you to delete a story from your Storyblok space. The example demonstrates how to delete a story by its ID.

client.delete('spaces/your-space-id/stories/your-story-id').then(response => {
  console.log('Story deleted');
}).catch(error => {
  console.error(error);
});

Other packages similar to storyblok-js-client

Keywords

FAQs

Package last updated on 15 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc